<template>
  <div>
    <van-nav-bar title="标题" class="myline" />
    <van-form @submit="onSubmit">
      <van-field
        v-model="username"
        name="用户名"
        label="手机号"
        placeholder="请输入手机号"
        :rules="[
          { required: true, message: '请填写手机号' },
          {
            pattern: /^(0|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57])[0-9]{8}$/,
            message: '请输入正确的手机号'
          }
        ]"
      />
      <van-field
        v-model="password"
        name="密码"
        label="验证吗"
        required
        placeholder="请输入验证码哦"
        :rules="[
          { required: true, message: '请填写验证码' },
          {
            pattern: /\d{6}/,
            message: '请输入正确的验证码'
          }
        ]"
      />
      <div style="margin: 16px;">
        <van-button round block type="info" native-type="submit"
          >提交</van-button
        >
      </div>
    </van-form>
  </div>
</template>

<script>
export default {
  name: 'login',
  data () {
    return {
      username: '',
      password: ''
    }
  },
  methods: {
    onSubmit (values) {
      console.log('submit', values)
    }
  }
}
</script>

<style lang="less">
.van-nav-bar__content {
  background-color: #1392e5;

  // background-color: #1392e5;
  color: white;
  .van-nav-bar__title {
    color: white;
  }
}
</style>
